package pub.zhou;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
/**
 * Created by shane on 16-12-20.
 */
@Service
public class TestRedis {
    public void connectRedis(){
        Jedis jedis = new Jedis("localhost");
        System.out.println("Connection to server sucessfully");
        //查看服务是否运行
        System.out.println("Server is running: "+jedis.ping());
    }
    public void testRedis(){
        Jedis jedis = new Jedis("localhost");
        System.out.println("Connection to server sucessfully");
        jedis.set("string","zhouhui");
        jedis.lpush("tutorial-list", "Redis");
        jedis.lpush("tutorial-list", "Mongodb");
        jedis.lpush("tutorial-list", "Mysql");

    }
}
